<template>
  <view class="page">
    <view class="input">
      <view class="input-wrapper" @click="dateShow = true">
        <view class="input-label">农事操作时间</view>
        <view class="input-put">{{
          $dayjs(date).format("YYYY-MM-DD HH:mm")
        }}</view>
        <image
          class="input-icon"
          :src="require('@/static/img/arrows-right.png')"
          mode="scaleToFill"
        />
      </view>
    </view>
    <view class="input">
      <view class="input-wrapper" @click="columnsShow = true">
        <view class="input-label">当日天气</view>
        <view class="input-put"
          >{{ array2[1][index2[1]] }} {{ array2[0][index2[0]] }}
        </view>
        <image
          class="input-icon"
          :src="require('@/static/img/arrows-right.png')"
          mode="scaleToFill"
        />
      </view>
    </view>
    <!-- 选择器 -->
    <view class="input">
      <view class="input-wrapper" @click="pickerShow = true">
        <view class="input-label">物候期</view>
        <view class="input-put">{{ array[0][index] }}</view>
        <image
          class="input-icon"
          :src="require('@/static/img/arrows-right.png')"
          mode="scaleToFill"
        />
      </view>
    </view>
    <!-- 农事操作 -->
    <view class="operat">
      <view class="operat-checkbox">
        <view class="operat-checkbox-title">
          <u-icon name="minus" color="#999"></u-icon>
          <view style="margin: 0 30rpx">农事操作</view>
          <u-icon name="minus" color="#999"></u-icon>
        </view>
        <view class="operat-checkbox-hint"
          >选择农事操作
          <text style="color: #999; font-size: 20rpx"
            >（可选择多个）</text
          ></view
        >
        <view class="operat-checkbox-tags">
          <view
            class="operat-checkbox-tag"
            :class="{ 'operat-checkbox-tag-active': item.change }"
            @click="onTagsChange(item)"
            v-for="(item, index) in operatTags"
            :key="index"
            >{{ item.name }}</view
          >
        </view>
      </view>
    </view>
    <!-- 上传照片 -->
    <view class="update-pics">
      <view class="update-pics-title">
        <text style="color: #4fb718; font-size: 24rpx; font-weight: bold"
          >照片</text
        >
        <text>（9张以内）</text>
        <view>拍照建议：拍摄作物、地块等信息</view>
      </view>
      <uUpload v-model="fileList1" width="120rpx" height="120rpx">
        <view class="plus-pic">
          <u-icon name="plus-circle" size="28" color="#ababab"></u-icon>
          <view style="">添加照片</view>
        </view>
      </uUpload>
    </view>
    <!-- 补充说明 -->
    <view class="update-pics">
      <view class="update-pics-title">
        <text style="color: #4fb718; font-size: 24rpx; font-weight: bold"
          >补充说明</text
        >
        <text>（600字以内）</text>
      </view>
      <textarea
        class="textarea"
        :maxlength="600"
        placeholder="还有那些事情比较重要，点这里记下来！"
      ></textarea>
      <view class="textarea-num">600/600</view>
    </view>
    <view class="btn-box">
      <button class="btn">
        <text class="btn-text" style="color: #fff">保存</text>
      </button>
    </view>
    <!-- 日期 -->
    <u-datetime-picker
      :show="dateShow"
      v-model="date"
      mode="datetime"
      @cancel="dateShow = false"
      @confirm="bindDateChange"
    ></u-datetime-picker>
    <!-- 天气 -->
    <u-picker
      :show="columnsShow"
      ref="uPicker"
      :columns="array2"
      @cancel="columnsShow = false"
      @confirm="bindPickerChange2"
    ></u-picker>
    <!-- 物候期 -->
    <u-picker
      :show="pickerShow"
      :columns="array"
      @cancel="pickerShow = false"
      @confirm="bindPickerChange"
    ></u-picker>
  </view>
</template>

<script>
import common from "./common";
import uUpload from "@/components/upload.vue";
export default {
  mixins: [common],
  components: {
    uUpload,
  },
  data() {
    return {
      operatTags: [
        { name: "施肥施肥是", change: false },
        { name: "除草", change: false },
        { name: "灌溉", change: false },
        { name: "喷药", change: false },
        { name: "采摘", change: false },
        { name: "其他", change: false },
        { name: "施肥施肥", change: false },
        { name: "除草", change: false },
        { name: "灌溉", change: false },
        { name: "喷药", change: false },
        { name: "采摘", change: false },
      ],
      fileList1: [],
    };
  },
  onLoad() {},
  mounted() {},
  methods: {
    gotoPage(item) {
      this.$u.route({
        url: `/pages/message/details`,
      });
    },
    onTagsChange(value) {
      value.change = !value.change;
    },
  },
};
</script>
<style lang="scss" scoped>
.page {
  padding-top: 20rpx;
  min-height: 100vh;
  background: #f6f6f6;
  padding-bottom: 150rpx;
}
.input {
  background: #fff;
  padding: 0 30rpx;

  &-wrapper {
    display: flex;
    align-items: center;
    border-bottom: 2rpx solid #e9e9e9;
    padding: 20rpx 0;
  }
  &-label {
    font-weight: bold;
    font-size: 26rpx;
    color: #202020;
  }
  &-put {
    flex: 1;
    font-size: 24rpx;
    text-align: right;
    color: #999999;
  }
  &-icon {
    width: 21rpx;
    height: 21rpx;
    margin-left: 5rpx;
  }
}
.operat {
  padding: 20rpx 30rpx;
  &-checkbox {
    width: 100%;
    // min-height: 500rpx;
    border-radius: 10rpx;
    background-color: #fff;
    padding: 35rpx 30rpx;
    &-title {
      font-weight: bold;
      font-size: 26rpx;
      color: #202020;
      display: flex;
      align-items: center;
      justify-content: center;
      margin-bottom: 20rpx;
    }
    &-hint {
      font-size: 24rpx;
      margin-bottom: 20rpx;
    }
    &-tags {
      display: flex;
      flex-wrap: wrap;
      //   justify-content: space-between;
    }
    &-tag {
      width: 200rpx;
      padding: 5rpx 0;
      text-align: center;
      border: 1px solid #e9e9e9;
      font-size: 24rpx;
      margin-right: 15rpx;
      margin-bottom: 20rpx;
      border-radius: 5rpx;
      &:nth-child(3n) {
        margin-right: 0;
      }
    }
    &-tag-active {
      color: #fff;
      background: #4fb718;
      border: 1px solid #4fb718;
    }
  }
}
.update-pics {
  background: #fff;
  padding: 20rpx 30rpx;
  margin-bottom: 20rpx;
  &-title {
    font-size: 20rpx;
    padding-bottom: 20rpx;
    color: #999;
    border-bottom: 1px solid #e9e9e9;
    margin-bottom: 20rpx;
  }
  .textarea {
    width: 100%;
    font-size: 24rpx;
  }
  .textarea-num {
    font-size: 18rpx;
    color: #999;
    text-align: right;
  }
}
.plus-pic {
  background: #f6f6f6;
  width: 120rpx;
  height: 120rpx;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  font-size: 20rpx;
  color: #999;
  border: 2px dashed #dcdcdc;
}
.plus-icon {
  width: 50rpx;
  height: 50rpx;
  margin-bottom: 10rpx;
}
.btn-box {
  position: fixed;
  left: 0;
  bottom: 0;
  width: 100%;
  // position: absolute;
  // bottom: 108rpx;
}
.btn {
  width: 100%;
  background: #4fb718;
  border-radius: 0rpx;
  margin: 0 auto;
  &-text {
    font-size: 32rpx;
    font-weight: 400;
    color: #ffffff;
  }
}
</style>
